import { FC, useCallback } from 'react';
import styles from './index.module.less';
import AppTable from '@/components/AppTable/index';
import { Button } from 'antd';
import { jump } from '@/utils/navigator';

interface pmManageMyProps {}

/**
 * 我的项目
 * @param props 
 * @returns 
 */
const ProjectManageMy: FC<pmManageMyProps> = function (props: pmManageMyProps) {
  // 跳转到新建项目页面
  const addProjectJump = useCallback(function () {
    jump('/project/add');
  }, []);
  return (
    <div className={styles.pmMyContainer}>
      <AppTable
        title="所有项目"
        api="/project/all"
        toolbarActions={[
          <Button type="primary" onClick={addProjectJump}>
            新增项目
          </Button>,
        ]}
        columns={[
          {
            title: '项目id',
            copyable: true,
            dataIndex: 'id',
          },
          {
            title: '名称',
            dataIndex: 'name',
          },
          {
            title: '仓库地址',
            copyable: true,
            search: false,
            dataIndex: 'respository',
          },
        ]}
      />
    </div>
  );
};

export default ProjectManageMy;
